package base.Day04;

public class ArrayDemo1
{
    public static void main(String[] args)
    {
        ArrayDemo1 arrayDemo1 = new ArrayDemo1();
        arrayDemo1.test();
        arrayDemo1.takeNum();
    }
    void test()
    {
        // 声明一个整形数组a,包含1个元素，每个元素都是int类型，默认值为0
        int[] a = new int[1];
        // 声明一个double类型数组，包含11个元素，每个元素都是double类型，默认值为0.0
        double[] doubles = new double[11];
        // 默认值为false
        boolean[] booleans = new boolean[11];
    }

    void test1()
    {
        int[] a1 = {1,33,4};
        int[] a2 = new int[]{1,3,4,56};

        int[] a3;
//        a3 = {1,3,4};   错误
        a3 = new int[]{1, 3, 45, 6, 7, 1, 1, 1, 1, 1, 1};
    }
    void takeNum()
    {
        int[] arr = new int[3];
        arr[1] = 100;
        arr[2] = 300;
        System.out.println(arr[1]);
        System.out.println(arr[arr.length-1]);


    }
}
